
import 'package:lepig/pages/category/Category.dart';
import 'package:lepig/pages/center/MyCenter.dart';
import 'package:lepig/pages/home/Home.dart';
import 'package:lepig/widget/bottomTabBar/BottomTabBarItem.dart';
import 'package:lepig/widget/bottomTabBar/BottomTabBarType.dart';
import 'package:flutter/material.dart';

class initPage extends StatefulWidget {
  initPage({Key key}) : super(key: key);

  @override
  _initPage createState() => _initPage();
}

class _initPage extends State<initPage> {
  int _counter = 0;
  int _pageIndex = 0;
  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }
  void _onItemTapped(int index) {
    setState(() {
      _pageIndex = index;
    });
  }

  var ListPage=[new Home(),new Category(),new MyCenter(),];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: IndexedStack(
        index: _pageIndex,
        alignment: Alignment.center,
        children: <Widget>[
          new Home(),
          new Category(),
          new MyCenter(),
        ],
      ),
//      bottomNavigationBar: BottomNavigationBar(
//        items: const <BottomNavigationBarItem>[
//          BottomNavigationBarItem(
//            icon: Icon(Icons.home),
//            title: Text('首页1'),
//          ),
//          BottomNavigationBarItem(
//            icon: Icon(Icons.category),
//            title: Text('分类'),
//          ),
////          BottomNavigationBarItem(
////            icon: Icon(Icons.school),
////            title: Text('发圈'),
////          ),
//          BottomNavigationBarItem(
//            icon: Icon(Icons.account_circle),
//            title: Text('我的'),
//          ),
//        ],
//        selectedItemColor: Colors.yellow,
//        type: BottomNavigationBarType.fixed,
//        currentIndex: _pageIndex,
//        onTap: _onItemTapped,
//      ),
      bottomNavigationBar: BottomTabBar(
        items: <BottomTabBarItem>[
          BottomTabBarItem(
              icon: Icon(Icons.home), title: Text("首页")),
          BottomTabBarItem(icon: Icon(Icons.category), title: Text("分类")),
          BottomTabBarItem(icon: Icon(Icons.account_circle), title: Text("我的")),

        ],
        fixedColor: Colors.black,
        currentIndex: _pageIndex,
        onTap: _onItemTapped,
        type: BottomTabBarType.fixed,
        isAnimation: false,
        isInkResponse: false,
        badgeColor: Colors.green,
      ),
    );
  }
}
